package com.hra.autoreset;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * 接受系统开机广播
 */
public class BootCompleteReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
            Intent i = new Intent(context, MainActivity.class);
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            try {
                context.startActivity(i);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

}
